package site.Interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

@Component
public class LoginCheckInterceptor extends HandlerInterceptorAdapter{

	@Override
	public boolean preHandle(HttpServletRequest Request,HttpServletResponse Response,Object handler) throws Exception{
		
		HttpSession session = Request.getSession();
		
		if(session.getAttribute("sid")==null){
			Response.sendRedirect("/user/Login.do");
			return false;
		}
		return true;
	}
}